package com.world.common.enumeration;

import lombok.Getter;

/**
 * 性别枚举
 *
 * @author WangYX
 * @version 1.0.0
 * @date 2023/08/01 15:43
 */
@Getter
public enum SexEnum {
    /**
     * 女
     */
    WOMAN("0", "女"),
    /**
     * 男
     */
    MAN("1", "男"),
    /**
     * 未知
     */
    UNKNOWN("2", "未知");


    private final String code;

    private final String name;

    SexEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public SexEnum of(String code) {
        if (code.equals(WOMAN.getCode())) {
            return WOMAN;
        }
        if (code.equals(MAN.getCode())) {
            return MAN;
        }
        return UNKNOWN;
    }

}
